#include "ExportDialog.h"
#include "ui_ExportDialog.h"
#include "Mcu.h"

ExportDialog *ExportDialog::getInstance()
{
    static ExportDialog singleton{};
    return &singleton;
}

void ExportDialog::busySlot()
{
    qDebug()<<"busy";
    ui->info->setText(tr("正在导出..."));
    ui->progress->setRange(0, 0);
}

void ExportDialog::completeSlot()
{
    qDebug()<<"complete";
    ui->info->setText(tr("导出完成"));
    ui->progress->setRange(0, 1);
    ui->progress->setValue(1);
}

void ExportDialog::resetSlot()
{
    qDebug()<<"reset";
    ui->progress->setRange(0, 1);
    ui->progress->setValue(0);
}

void ExportDialog::exportErrorSlot()
{
    ui->info->setText(tr("导出失败，请重试"));
}

ExportDialog::ExportDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ExportDialog)
{
    ui->setupUi(this);
}

ExportDialog::~ExportDialog()
{
    delete ui;
}

void ExportDialog::on_cancel_clicked()
{
    Mcu::getInstance()->touchSoundBeepMessage();
    resetSlot();
    hide();
}
